﻿
    <Fluent:RibbonWindow
				xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
				xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
				xmlns:Fluent="clr-namespace:Fluent;assembly=Fluent" mc:Ignorable="d" x:Class="Visuals.MainWindow2"
                WindowStartupLocation="CenterScreen"
				Title="Relate2spot" Height="550" Width="950">
    <DockPanel LastChildFill="True">
        
        <Fluent:Ribbon Name="ribbon" DockPanel.Dock="Top">
            <Fluent:Ribbon.QuickAccessItems>
                <Fluent:QuickAccessMenuItem IsChecked="True" Target="{Binding ElementName=loadCorpusButton}"/>
                <Fluent:QuickAccessMenuItem IsChecked="False" Target="{Binding ElementName=openButton}"/>
                <Fluent:QuickAccessMenuItem IsChecked="False" Target="{Binding ElementName=saveButton}"/>
            </Fluent:Ribbon.QuickAccessItems>

            <Fluent:Ribbon.ContextualGroups>
                <Fluent:RibbonContextualTabGroup Header="Дума" Visibility="Collapsed" x:Name="wordInfo" Background="Green" BorderBrush="Green" />
                <Fluent:RibbonContextualTabGroup Header="Документ" Visibility="Collapsed" x:Name="documentInfo" Background="Red" BorderBrush="Red" />
            </Fluent:Ribbon.ContextualGroups>

            
            <Fluent:Ribbon.Menu>
                <Fluent:Backstage>
                    <Fluent:BackstageTabControl Name="backstage">
                        <Fluent:Button x:Name="loadCorpusButton" Header="Зареди корпус" Icon="images/load-corpus.png" Click="loadCorpusButton_Click" />
                        <Fluent:Button x:Name="openButton" Header="Отвори" Icon="images/open.png" Click="openButton_Click" />
                        <Fluent:Button x:Name="saveButton" Header="Запази" Icon="images/save.png" Click="saveButton_Click" />
                        <Fluent:BackstageTabItem Header="Допълнително">

                        </Fluent:BackstageTabItem>
                        <Fluent:BackstageTabItem Header="Настройки">
                            <Grid Margin="30" VerticalAlignment="Top" HorizontalAlignment="Left">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="300" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <Canvas>
                                    <Label Canvas.Top="0" Canvas.Left="0" Height="37" Width="300" Content="Stop Words" FontSize="18" BorderThickness="0, 0, 0, 1" BorderBrush="#CCC" Foreground="Blue" />
                                    <TextBox Canvas.Left="0" Canvas.Top="55"  Grid.Column="0" Height="23" Name="stopWordInput" Width="250"/>
                                    <Button Canvas.Left="0" Canvas.Top="85" Grid.Column="0" Height="21" Width="50" Click="addStopWordButton_Click">Add</Button>
                                    <Button Canvas.Left="70" Canvas.Top="85" Grid.Column="0" Height="21" Width="50" Click="removeStopWordButton_Click">Remove</Button>
                                    <ListView Canvas.Left="0" Canvas.Top="115" Grid.Column="0" Height="183" Name="stopWordsList" Width="250" SelectionMode="Single">
                                        <ListView.View>
                                            <GridView>
                                                <GridViewColumn Header="Стоп дума" Width="220"></GridViewColumn>
                                            </GridView>
                                        </ListView.View>
                                    </ListView>
                                </Canvas>
                            </Grid>
                        </Fluent:BackstageTabItem>
                        <Fluent:Button x:Name="aboutButton" Header="Информация" Icon="images/load-corpus.png" Click="aboutButton_Click" />
                    </Fluent:BackstageTabControl>
                </Fluent:Backstage>
            </Fluent:Ribbon.Menu>
            
            <Fluent:RibbonTabItem Header="Главни функиции" Name="generalTab" Focusable="True">
                <Fluent:RibbonGroupBox Header="Настройки">
                    <Fluent:Spinner x:Name="numberOfDimensions" Header="Измерения" Value="0" Minimum="0">
                        <Fluent:Spinner.ToolTip>
                            <Fluent:ScreenTip Title="Брой на латентните измерения" Text="Трябва да се зададе преди да се зареди корпусът. Показва колко измерения ще съдържа латентното пространство. Максималната стойност е броят на файловете. Остаете 0 за максимален брой, но имайте предвид, че това не винаги е оптималната стойност." MaxWidth="300" />
                        </Fluent:Spinner.ToolTip>
                    </Fluent:Spinner>
                    <Fluent:Spinner x:Name="numberOfGraphicNodes" Header="Графични клонове" Value="8" Minimum="3" Maximum="20">
                        <Fluent:Spinner.ToolTip>
                            <Fluent:ScreenTip Title="Number of main graph nodes" Text="The number of nodes in the central graphic." />
                        </Fluent:Spinner.ToolTip>
                    </Fluent:Spinner>
                    <Fluent:CheckBox x:Name="useTfIdf" Header="Използва TF-IDF" IsChecked="False">
                        <Fluent:CheckBox.ToolTip>
                            <Fluent:ScreenTip Title="Use Term Frequency - Inverse Document Frequency" Text="Should be set before corpus loaded. This is a method to fill the frequency matrix." />
                        </Fluent:CheckBox.ToolTip>
                    </Fluent:CheckBox>
                    <Fluent:CheckBox x:Name="shouldStem" Header="Сегментация" IsChecked="False">
                        <Fluent:CheckBox.ToolTip>
                            <Fluent:ScreenTip Title="Сегментация" Text="Ще преубразува думи като relates, relating в relate. Може да възникнат проблеми като relat." />
                        </Fluent:CheckBox.ToolTip>
                    </Fluent:CheckBox>

                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox Header="Други">
                    <Fluent:Button Name="rebuildButton" Header="Изграждане" Icon="Images\Green.png" LargeIcon="Images\GreenLarge.png" Click="rebuildButton_Click">
                        <Fluent:Button.ToolTip>
                            <Fluent:ScreenTip Title="Изграждане на матрица" Text="Rebuilds the matrix with the changes made by you in mind."/>
                        </Fluent:Button.ToolTip>
                    </Fluent:Button>
                    <Fluent:Button Name="searchButton" Header="Търсене" Icon="Images\Green.png" LargeIcon="Images\GreenLarge.png" Click="searchButton_Click">
                    </Fluent:Button>
                </Fluent:RibbonGroupBox>
                
            </Fluent:RibbonTabItem>
            <Fluent:RibbonTabItem Header="Групиране" Name="groupsTab" Focusable="True">
                <Fluent:RibbonGroupBox Header="Думи">
                    <Fluent:Spinner x:Name="wordsClustersSpinner" Header="Брой на групите" Value="1" Minimum="1" Maximum="2">
                        <Fluent:Spinner.ToolTip>
                            <Fluent:ScreenTip Title="Number of groups" Text="This field indicates in how many groups you want to divide the words." />
                        </Fluent:Spinner.ToolTip>
                    </Fluent:Spinner>
                    <Fluent:Spinner x:Name="wordsPerClusterSpinner" Header="Думи на група" Value="1" Minimum="1" Maximum="2">
                        <Fluent:Spinner.ToolTip>
                            <Fluent:ScreenTip Title="Number of words per group" Text="This field indicates in how many top results will be listed." />
                        </Fluent:Spinner.ToolTip>
                    </Fluent:Spinner>
                    <Fluent:Button Name="wordsGroup" Header="Група" Icon="Images\Green.png" LargeIcon="Images\GreenLarge.png" IsEnabled="False" Click="wordsGroup_Click">
                        <Fluent:Button.ToolTip>
                            <Fluent:ScreenTip Title="Words Group" Text="Performs the grouping task."/>
                        </Fluent:Button.ToolTip>
                    </Fluent:Button>
                    <Fluent:Button Name="wordsGroupsPreview" Header="Преглед" Icon="Images\Green.png" LargeIcon="Images\GreenLarge.png" IsEnabled="False" Click="wordsGroupsPreview_Click">
                        
                    </Fluent:Button>
                </Fluent:RibbonGroupBox>
            </Fluent:RibbonTabItem>
            <Fluent:RibbonTabItem Header="Специфика на думата" Group="{Binding ElementName=wordInfo}" Visibility="Collapsed">
                <Fluent:RibbonGroupBox Header="Връзки">
                    <Fluent:Button Name="wordToWordButton" Header="Дума-Дума" Icon="Images\Green.png" LargeIcon="Images\GreenLarge.png" Click="wordToWordButton_Click" IsEnabled="False">
                        <Fluent:Button.ToolTip>
                            <Fluent:ScreenTip Title="Word-Word relation" Text="This function returns the cosine similarity between two words."/>
                        </Fluent:Button.ToolTip>
                    </Fluent:Button>
                </Fluent:RibbonGroupBox>
                <Fluent:RibbonGroupBox Header="Сюжети">
                    <Fluent:Spinner x:Name="wordsD1Spinner" Header="1во измерение" Value="1" Minimum="1" Maximum="2" />
                    <Fluent:Spinner x:Name="wordsD2Spinner" Header="2ро измерение" Value="2" Minimum="1" Maximum="2" />
                    <Fluent:CheckBox x:Name="wordsAbsCheckbox" Header="Относителни координати" IsChecked="False">
                        <Fluent:CheckBox.ToolTip>
                            <Fluent:ScreenTip Title="Относителни координати" Text="This field indicates whether to divide the coorinates to the largest one and multiply by 100 or not." />
                        </Fluent:CheckBox.ToolTip>
                    </Fluent:CheckBox>
                    <Fluent:Button Name="wordsChartButton" Header="Думи 2D" Icon="Images\Green.png" LargeIcon="Images\GreenLarge.png" Click="wordsChartButton_Click">
                        <Fluent:Button.ToolTip>
                            <Fluent:ScreenTip Title="Графика на думите" Text="Displays all the selected words in 2D space with the dimensions selected."/>
                        </Fluent:Button.ToolTip>
                    </Fluent:Button>
                </Fluent:RibbonGroupBox>
            </Fluent:RibbonTabItem>
            <Fluent:RibbonTabItem Header="Специфика на документа" Group="{Binding ElementName=documentInfo}" Visibility="Collapsed">
                <Fluent:RibbonGroupBox Header="Връзки">
                    <Fluent:Button Name="documentToDocumentButton" Header="Документ-Документ" Icon="Images\Orange.png" LargeIcon="Images\OrangeLarge.png" Click="documentToDocumentButton_Click" IsEnabled="False">
                        <Fluent:Button.ToolTip>
                            <Fluent:ScreenTip Title="Връзка документ-документ" Text="This function returns the cosine similarity between two documents."/>
                        </Fluent:Button.ToolTip>
                    </Fluent:Button>
                </Fluent:RibbonGroupBox>
            </Fluent:RibbonTabItem>
        </Fluent:Ribbon>

        <Grid Margin="5,10,5,5">

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="169*" />
                <ColumnDefinition Width="534*" />
                <ColumnDefinition Width="169*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="250*" />
                <RowDefinition Height="150*" />
            </Grid.RowDefinitions>
            <GridSplitter HorizontalAlignment="Right" Width="1" Grid.Column="0" Grid.RowSpan="2" />

            <ListView x:Name="wordsList" Margin="0,23,6,3" BorderBrush="#FFD3D6D9" SelectionChanged="wordsList_SelectionChanged" MouseDoubleClick="wordsList_MouseDoubleClick" PreviewMouseRightButtonUp="wordsList_PreviewMouseRightButtonUp" PreviewMouseRightButtonDown="wordsList_PreviewMouseRightButtonDown">
                <ListView.ContextMenu>
                    <ContextMenu x:Name="contextMenu">
                        <MenuItem Header="Виж в свързаните документи" Icon="Images/Green.png" Click="wordsListContextMenu_ViewSearch" />
                        <MenuItem Header="Добави към стоп листа" Icon="Images/Green.png" Click="wordsListContextMenu_AddToStopList" />
                    </ContextMenu>
                </ListView.ContextMenu>

                <ListView.View>
                    <GridView>
                        <GridViewColumn Width="50" Header="ID" x:Name="Id" DisplayMemberBinding="{Binding Value}" />
                        <GridViewColumn Width="100" Header="Дума" x:Name="Word" DisplayMemberBinding="{Binding Key}" />
                    </GridView>
                </ListView.View>
            </ListView>
            <TextBox x:Name="SearchBox" Height="20" Margin="0,0,6,0" VerticalAlignment="Top" Grid.Column="0" Grid.Row="0" TextChanged="SearchBox_Update" />

            <ListView x:Name="documentsList" Margin="0,2,6,0" BorderBrush="#FFD3D6D9" Grid.Row="1" SelectionChanged="documentsList_SelectionChanged" MouseDoubleClick="documentsList_MouseDoubleClick">
                <ListView.View>
                    <GridView>
                        <GridViewColumn Header="Файл" DisplayMemberBinding="{Binding File}" />
                        <GridViewColumn Header="Думи" DisplayMemberBinding="{Binding Words}" />
                    </GridView>
                </ListView.View>
            </ListView>
            
            <Canvas x:Name="drawGrid" Height="353" Width="550" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.RowSpan="2" SizeChanged="drawGrid_SizeChanged" Grid.Column="1" Margin="6,2">
                <Label Margin="0, 230, 0, 100" Canvas.Left="95" Canvas.Top="-62">Моля направете нужните настройки и натиснете 'Изграждане'.</Label>
            </Canvas>

            <ListView x:Name="searchResultsList" BorderBrush="#FFD3D6D9" Grid.Column="2" Grid.RowSpan="2">
                <ListView.View>
                    <GridView>
                        <GridViewColumn Width="50" Header="ID" x:Name="Id0" DisplayMemberBinding="{Binding Title}" />
                        <GridViewColumn Width="100" Header="Дума" x:Name="Word0" DisplayMemberBinding="{Binding Content}" />
                    </GridView>
                </ListView.View>
            </ListView>

        </Grid>
    </DockPanel>

</Fluent:RibbonWindow>
